import { defineStore } from 'pinia'
import { store } from '/@/store'
import type { AxiosResponse } from 'axios'
import type { Res } from '/@/tool/Res'
import type { Param } from '/@/tool/Param'

import dataManipulationLogService from '/@/api/cn/core/data/dataManipulationLogService'

import type { DataManipulationLog } from '/@/model/cn/core/data/eo/DataManipulationLog'
import type { DataManipulationLogQO } from '/@/model/cn/core/data/qo/DataManipulationLogQO'
import type { DataManipulationLogVO } from '/@/model/cn/core/data/vo/DataManipulationLogVO'

interface DataManipulationLogState {
}

export const useDataManipulationLogStore = defineStore({
  id: 'dataManipulationLog',
  state: (): DataManipulationLogState => ({
  }),
  getters: {
  },
  actions: {
    save(param: Param<DataManipulationLog>): Promise<Res<DataManipulationLog>> {
      return new Promise<Res<DataManipulationLog>>((resolve, reject) => {
        dataManipulationLogService.save(param).then((res: AxiosResponse<Res<DataManipulationLog>>) => {
          resolve(res.data)
        }).catch(err => {
          reject(err)
        })
      })
    },
    saveBatch(param: Param<DataManipulationLog>): Promise<Res<DataManipulationLog>> {
      return new Promise<Res<DataManipulationLog>>((resolve, reject) => {
        dataManipulationLogService.saveBatch(param).then((res: AxiosResponse<Res<DataManipulationLog>>) => {
          resolve(res.data)
        }).catch(err => {
          reject(err)
        })
      })
    },
    update(param: Param<DataManipulationLog>): Promise<Res<DataManipulationLog>> {
      return new Promise<Res<DataManipulationLog>>((resolve, reject) => {
        dataManipulationLogService.update(param).then((res: AxiosResponse<Res<DataManipulationLog>>) => {
          resolve(res.data)
        }).catch(err => {
          reject(err)
        })
      })
    },
    updateBatch(param: Param<DataManipulationLog>): Promise<Res<DataManipulationLog>> {
      return new Promise<Res<DataManipulationLog>>((resolve, reject) => {
        dataManipulationLogService.updateBatch(param).then((res: AxiosResponse<Res<DataManipulationLog>>) => {
          resolve(res.data)
        }).catch(err => {
          reject(err)
        })
      })
    },
    remove(param: Param<DataManipulationLog>): Promise<Res<DataManipulationLog>> {
      return new Promise<Res<DataManipulationLog>>((resolve, reject) => {
        dataManipulationLogService.remove(param).then((res: AxiosResponse<Res<DataManipulationLog>>) => {
          resolve(res.data)
        }).catch(err => {
          reject(err)
        })
      })
    },
    removeBatch(param: Param<DataManipulationLog>): Promise<Res<DataManipulationLog>> {
      return new Promise<Res<DataManipulationLog>>((resolve, reject) => {
        dataManipulationLogService.removeBatch(param).then((res: AxiosResponse<Res<DataManipulationLog>>) => {
          resolve(res.data)
        }).catch(err => {
          reject(err)
        })
      })
    },
    count(param: Param<DataManipulationLogQO>): Promise<Res<DataManipulationLog>> {
      return new Promise<Res<DataManipulationLog>>((resolve, reject) => {
        dataManipulationLogService.count(param).then((res: AxiosResponse<Res<DataManipulationLog>>) => {
          resolve(res.data)
        }).catch(err => {
          reject(err)
        })
      })
    },
    pk(param: Param<DataManipulationLogQO>): Promise<Res<DataManipulationLog>> {
      return new Promise<Res<DataManipulationLog>>((resolve, reject) => {
        dataManipulationLogService.pk(param).then((res: AxiosResponse<Res<DataManipulationLog>>) => {
          resolve(res.data)
        }).catch(err => {
          reject(err)
        })
      })
    },
    query(param: Param<DataManipulationLogQO>): Promise<Res<DataManipulationLog>> {
      return new Promise<Res<DataManipulationLog>>((resolve, reject) => {
        dataManipulationLogService.query(param).then((res: AxiosResponse<Res<DataManipulationLog>>) => {
          resolve(res.data)
        }).catch(err => {
          reject(err)
        })
      })
    },
    paging(param: Param<DataManipulationLogQO>): Promise<Res<DataManipulationLog>> {
      return new Promise<Res<DataManipulationLog>>((resolve, reject) => {
        dataManipulationLogService.paging(param).then((res: AxiosResponse<Res<DataManipulationLog>>) => {
          resolve(res.data)
        }).catch(err => {
          reject(err)
        })
      })
    },
    countVo(param: Param<DataManipulationLogQO>): Promise<Res<DataManipulationLogVO>> {
      return new Promise<Res<DataManipulationLogVO>>((resolve, reject) => {
        dataManipulationLogService.countVo(param).then((res: AxiosResponse<Res<DataManipulationLogVO>>) => {
          resolve(res.data)
        }).catch(err => {
          reject(err)
        })
      })
    },
    pkVo(param: Param<DataManipulationLogQO>): Promise<Res<DataManipulationLogVO>> {
      return new Promise<Res<DataManipulationLogVO>>((resolve, reject) => {
        dataManipulationLogService.pkVo(param).then((res: AxiosResponse<Res<DataManipulationLogVO>>) => {
          resolve(res.data)
        }).catch(err => {
          reject(err)
        })
      })
    },
    queryVo(param: Param<DataManipulationLogQO>): Promise<Res<DataManipulationLogVO>> {
      return new Promise<Res<DataManipulationLogVO>>((resolve, reject) => {
        dataManipulationLogService.queryVo(param).then((res: AxiosResponse<Res<DataManipulationLogVO>>) => {
          resolve(res.data)
        }).catch(err => {
          reject(err)
        })
      })
    },
    pagingVo(param: Param<DataManipulationLogQO>): Promise<Res<DataManipulationLogVO>> {
      return new Promise<Res<DataManipulationLogVO>>((resolve, reject) => {
        dataManipulationLogService.pagingVo(param).then((res: AxiosResponse<Res<DataManipulationLogVO>>) => {
          resolve(res.data)
        }).catch(err => {
          reject(err)
        })
      })
    },
  },
})

export function useDataManipulationLogStoreWithout() {
  return useDataManipulationLogStore(store)
}
